<?
include "connectDB.php";

ini_set('memory_limit','512M');
$post;
/*
$query1 = 'select * from so_posts';
	$result1 = mysql_query($query1) or die(mysql_error());
	$tot = mysql_num_rows($result1);
	$f=0;
	while($posts = mysql_fetch_array($result1)){
	$post[++$f] = $posts['Body'];
	}
	*/
//echo mysql_num_rows($result1);
$query2 = 'select page_title from page where page_namespace=14 limit 100';
$result2 = mysql_query($query2) or die(mysql_error());
$total_concepts = mysql_num_rows($result2);
$m=0;
$c=0;
$concepts = array();
//$concepts = array_fill(0,400000, 0);
$matched;
$topic;
$g=0;
$c=0;
	while($categories = mysql_fetch_array($result2)){
		$concept = strtolower(str_replace('_',' ',$categories['page_title']));
		//echo $concept.'<br>';
		//if(trim($post) != null){
		//if(substr_count($post, $concept)) $matches++;;
		//echo substr_count($post, 'linux');
		$matches=0;
		//foreach($post as $p){
			 $query5 = "select * from so_posts where Body like '%".mysql_escape_string($concept)."%'";
			 //echo $query5;
			 $result5 = mysql_query($query5) or die(mysql_error());
			 $matches = mysql_num_rows($result5);
		//}
		if($matches > $c) {
			$c = $matches;
		}
	}
	//echo $concept;
	//$c++;	
	
echo '<h1>'.$c.'</h1>';
?>